<?php

namespace App\Controller\InsideService;

use App\Model\QmGameVersion;
use Exception;

class PaySenderInside extends BaseInside {

    /**
     * 获取用户信息
     * @param $orderInfo
     * @return mixed
     */
    public function sendReward($orderInfo): mixed {
        $conCode = (new QmGameVersion())->getCode($orderInfo['game_hash'], $orderInfo['version']);
        $res = $this->setCode($conCode)->postInfo('PaySender/reward', ['order_info' => $orderInfo]);
        return $res['data'];
    }

    /**
     * 获取用户信息
     * @param $orderInfo
     * @return mixed
     */
    public function sendData($orderInfo): mixed {
        $conCode = (new QmGameVersion())->getCode($orderInfo['game_hash'], $orderInfo['version']);
        $res = $this->setCode($conCode)->postInfo('PaySender/sendData', ['order_info' => $orderInfo]);
        return $res['data'];
    }

    /**
     * 获取用户信息
     * @param $orderInfo
     * @return mixed
     */
    public function reSendReward($orderInfo, $op): mixed {
        $conCode = (new QmGameVersion())->getCode($orderInfo['game_hash'], $orderInfo['version']);
        $res = $this->setCode($conCode)->postInfo('PaySender/reSend', ['order_info' => $orderInfo, 'op' => $op]);
        return $res['data'];
    }

    /**
     * 更新用户头像
     * @param $game_hash
     * @param $version
     * @param $openid
     * @return mixed
     * @throws Exception
     */
    public function updateUserAvatar($game_hash, $version, $openid): mixed {
        $conCode = (new QmGameVersion())->getCode($game_hash, $version);
        $res = $this->setCode($conCode)->postInfo('PaySender/updateUserAvatar', ['game_hash' => $game_hash, 'openid' => $openid]);
        return $res['data'];
    }
}